<template>
<div class="paySuccess">
<h3><img src="../../assets/img/gou2.png"/>恭喜你,支付成功啦!</h3>
  <el-button type="danger" style="margin: 30px 0 30px 480px" @click="$router.push('/center')">查看订单</el-button>
  <el-button @click="$router.push('/home')">继续购物</el-button>
</div>
</template>

<script>
export default {
  name: "paySuccess",
  beforeRouteEnter(to,from,next){//组件内的守卫,该函数不能获取组件的实例,由于组件实例还没被创建
    if(from.path=='/pay'){
      next()
    }else{
      next(false)
    }
  }
}
</script>

<style scoped lang="less">
.paySuccess{
  width: 1148px;
  margin: 20px auto;
  border: 1px solid #d3d3d3;
  padding: 25px;
  h3{
    text-align: center;
    img{
      width: 48px;
      height: 48px;
     margin-right: 14px;
      vertical-align: middle;
    }
    margin: 20px 0;
  }
}
</style>
